<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLoginLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('login_log', function (Blueprint $table) {
            $table->engine = 'innodb';
            $table->increments('id')->unsigned();
            $table->unsignedInteger('user_id')->default(0)->comment('管理员id')->index('user_id');
            $table->char('ip', 15)->default('')->comment('登录ip');
            $table->unsignedInteger('login_time')->default(0)->comment('登录时间');
            $table->string('address', 100)->default('')->comment('登录地址');
            $table->string('browser', 100)->default('')->comment('浏览器');
            $table->string('platform', 100)->default('')->comment('操作系统');
            $table->string('language', 100)->default('')->comment('语言');
            $table->string('device', 100)->default('')->comment('设备名称');
            $table->string('device_type', 100)->default('')->comment('设备类型');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('login_log');
    }
}
